package cn.xinfei.xdecision.common.service.configcenter;


import cn.xinfei.xdecision.common.model.configcenter.rejectcode.po.RejectBranchCode;
import cn.xinfei.xdecision.common.model.configcenter.rejectcode.po.RejectCategory;
import cn.xinfei.xdecision.common.model.configcenter.rejectcode.po.RejectCode;
import cn.xinfei.xdecision.common.model.configcenter.rejectcode.po.RejectDiversionLabel;
import cn.xinfei.xdecision.common.model.configcenter.rejectcode.vo.*;

public class DataCovertUtils {
    public static RejectCategoryResp covertResp(RejectCategory rejectCategory) {
        if (rejectCategory == null) {
            return new RejectCategoryResp();
        }
        RejectCategoryResp rejectCategoryResp = new RejectCategoryResp();
        rejectCategoryResp.setId(rejectCategory.getId());
        rejectCategoryResp.setName(rejectCategory.getName());
        rejectCategoryResp.setParentId(rejectCategory.getParentId());
        return rejectCategoryResp;
    }

    public static RejectCodeResp covertResp(RejectCode rejectCode) {
        if (rejectCode == null) {
            return new RejectCodeResp();
        }
        RejectCodeResp rejectCodeResp = new RejectCodeResp();
        rejectCodeResp.setId(rejectCode.getId());
        rejectCodeResp.setName(rejectCode.getName());
        rejectCodeResp.setCategoryId(rejectCode.getCategoryId());
        return rejectCodeResp;
    }

    public static RejectBranchCode covertBean(RejectBranchCodeCreateAndUpdateReq req) {
        if (req == null) {
            return new RejectBranchCode();
        }
        RejectBranchCode rejectBranchCode = new RejectBranchCode();
        rejectBranchCode.setRejectCodeId(req.getRejectCodeId());
        rejectBranchCode.setDiversionLabelId(req.getDiversionLabelId());
        rejectBranchCode.setName(req.getName());
        rejectBranchCode.setRemark(req.getRemark());
        rejectBranchCode.setAttributes(req.getAttributes());

        rejectBranchCode.setProhibitedApplyTime(req.getProhibitedApplyTime());
        return rejectBranchCode;
    }

    public static RejectBranchCodeResp covertResp(RejectBranchCode rejectBranchCode) {
        if (rejectBranchCode == null) {
            return new RejectBranchCodeResp();
        }
        RejectBranchCodeResp rejectBranchCodeResp = new RejectBranchCodeResp();
        rejectBranchCodeResp.setId(rejectBranchCode.getId());
        rejectBranchCodeResp.setRejectCodeId(rejectBranchCode.getRejectCodeId());
        rejectBranchCodeResp.setDisplayName(rejectBranchCode.getDisplayName());
        rejectBranchCodeResp.setRejectCodeName(rejectBranchCode.getRejectCodeName());
        rejectBranchCodeResp.setCategoryId(rejectBranchCode.getCategoryId());
        rejectBranchCodeResp.setCategoryName(rejectBranchCode.getCategoryName());
        rejectBranchCodeResp.setCategoryDetailsId(rejectBranchCode.getCategoryDetailsId());
        rejectBranchCodeResp.setCategoryDetailsName(rejectBranchCode.getCategoryDetailsName());
        rejectBranchCodeResp.setDiversionLabelId(rejectBranchCode.getDiversionLabelId());
        rejectBranchCodeResp.setDiversionLabelName(rejectBranchCode.getDiversionLabelName());
        rejectBranchCodeResp.setName(rejectBranchCode.getName());
        rejectBranchCodeResp.setRemark(rejectBranchCode.getRemark());
        rejectBranchCodeResp.setAttributes(rejectBranchCode.getAttributes());
        rejectBranchCodeResp.setProhibitedApplyTime(rejectBranchCode.getProhibitedApplyTime());
        rejectBranchCodeResp.setCreatedTime(rejectBranchCode.getCreatedTime());
        rejectBranchCodeResp.setUpdatedTime(rejectBranchCode.getUpdatedTime());
        rejectBranchCodeResp.setCreateUserId(rejectBranchCode.getCreateUserId());
        return rejectBranchCodeResp;
    }

    public static RejectDiversionLabelResp covertResp(RejectDiversionLabel diversionLabel) {
        if (diversionLabel == null) {
            return new RejectDiversionLabelResp();
        }
        RejectDiversionLabelResp rejectDiversionLabelResp = new RejectDiversionLabelResp();
        rejectDiversionLabelResp.setRemark(diversionLabel.getRemark());
        rejectDiversionLabelResp.setId(diversionLabel.getId());
        rejectDiversionLabelResp.setName(diversionLabel.getName());
        rejectDiversionLabelResp.setWeights(diversionLabel.getWeights());
        rejectDiversionLabelResp.setCreatedTime(diversionLabel.getCreatedTime());
        rejectDiversionLabelResp.setUpdatedTime(diversionLabel.getUpdatedTime());
        return rejectDiversionLabelResp;
    }
}
